package myPack.GMAO.Bean;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import myPack.GMAO.Entity.Batiment;
import myPack.GMAO.Interface.BatimentInterface;

@Stateless(mappedName="Batiment")
public class BatimentBean implements BatimentInterface
{
	@PersistenceContext
	EntityManager em;
	
	@Override
	public void Ajouter(Batiment s) {
		em.persist(s);
	}
	@Override
	public Batiment Chercher(int idB) {
		return em.find(Batiment.class,idB);
	} 
	@Override
	public List<Batiment> Lister() {
		return em.createQuery("from Batiment").getResultList();
	}
	@Override
	public void Supprimer(int idB) {
		em.remove(em.find(Batiment.class,idB));
	}
	
}
